import request from "@/utils/request";
import type { swiperReturnType, recommendReturnType, tagReturnType, searchReturn } from "./interface";

// 1.请求轮播图
export const reqGetSwiper = () => {
    return request.get<null, swiperReturnType>(
        `http://zsjyyds.online:9000/apis/promotion/ads/search/findByPosition?access_token=c494ae44-3adc-48ca-8749-5128a53358d7&position=pc_mainpage`
    );
};
// 2.请求推荐数据
export const reqGetRecommend = (pageNum: number = 1, pageSize: number = 20) => {
    return request.get<null, recommendReturnType>(
        `http://zsjyyds.online:9000/apis/moment/moments/rec/default?access_token=c494ae44-3adc-48ca-8749-5128a53358d7&column=recommend&pageSize=${pageSize}&pageNum=${pageNum}`
    );
};
// 3.请求兴趣列表
export const reqGetInterestList = (pageNum: number = 1, pageSize: number = 20) => {
    return request.get<null, tagReturnType>(
        `http://zsjyyds.online:9000/apis/avocation/avocations/rec/user?access_token=6b44a37a-0df2-4a8a-a4b8-7c0cd2d2a222&pageNum=${pageNum}&pageSize=${pageSize}`
    );
};
// 4.请求个人信息（包含已选兴趣列表）
export const reqGetSlectedInterest = () => {
    return request.get(
        `http://zsjyyds.online:9000/apis/userCenter/users/me?access_token=6b44a37a-0df2-4a8a-a4b8-7c0cd2d2a222`
    );
};
// 5.关键字搜索兴趣列表
export const reqGetSearchInterest = (searchValue: string) => {
    return request.get<null, searchReturn>(
        `http://zsjyyds.online:9000/apis/avocation/avocations/search/findByName?access_token=6b44a37a-0df2-4a8a-a4b8-7c0cd2d2a222&name=${searchValue}`
    );
};
